package com.chujian.Activities;

import java.util.Date;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.CalendarView;
import android.widget.CalendarView.OnDateChangeListener;

import com.chujian.Utils.Util;
import com.chujian.orderingsystem.R;

public class IncomeGetDateDialog extends Activity{
	private CalendarView mCalendar;
	private int mYear;
	private int mMonth;
	private int mDayOfMonth;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		this.requestWindowFeature(Window.FEATURE_NO_TITLE);//去掉标题栏  
		setContentView(R.layout.income_date);
		initView();
		
	}
	private void initView() {
		// TODO Auto-generated method stub
		mCalendar=(CalendarView) findViewById(R.id.cv_income_date_calendar);
		mCalendar.setOnDateChangeListener(new OnDateChangeListener() {

			@Override
			public void onSelectedDayChange(CalendarView view, int year,
					int month, int dayOfMonth) {
				// TODO Auto-generated method stub
				mYear=year;
				mMonth=month;
				mDayOfMonth=dayOfMonth;
			}
			
		}); 
	}
	
	public void confirm(View v){
		Util.showTextShort(getApplicationContext(), mYear+"/"+mMonth+"/"+mDayOfMonth);
		Intent intent =new Intent();
		Date date=new Date(mYear-1900, mMonth, mDayOfMonth);
		Long dateTime=date.getTime();
		intent.putExtra("dateTime", dateTime);
		setResult(2001, intent);
		finish();
	}
}
